		Astro Blast from April 1983 Chromasette:
		========================================

Has 2 main ML subroutines (and some graphics hidden after the BASIC program itself)
These are called via USR0 and USR1 (neither return anything).
The game as released by Chromasette was hardcoded for cassette systems with 16K RAM.
This version is for disk systems with 32K RAM (the original can be found on the April
  1983 issue of Chromasette).

The game is mostly BASIC (with optional speedup POKE), except for some sound and a little
of the graphics. Both routines use a POKE system to set up parameters, and thus you could
use these in your own programs.

Details on the two machine language subroutines:

USR0 routine: This routine does sound effects. The subroutine code itself starts at
&H7F07, and it used the following parameters that you POKE in yourself before calling it:
  &H7F00-7F01 - # of times to repeat the sound sample before returning to BASIC
  &H7F02 - time delay counter between samples (5 CPU cycles per sample)
  &H7F03-7F04 - Pointer to start of sound data/sample (only uses lower 6 bits)
  &H7F05-7F06 - Pointer to end of sound data/sample (only uses lower 6 bits)
To get different effects, use both the time delay counter and the memory pointers. The
game itself actually points to a chunk of the Extended BASIC ROM for it's explosion sound
effect, for example.

USR1 routine: This routine does a machine language memory copy, which you can use for graphics,
the text screen or whatever else that would like. This routine starts at &H300, and the parameters
that you POKE in directly modify the routine each time
  &H0301-0302 - Pointer to the destination of the memory copy
  &H0305-0306 - Pointer to the source of the memory copy
  &H030C-030D - Pointer to the end destination address of the copy


	Disassembly of the two routines:
	================================

Here is the disassembled source code for both routines, as it is POKE'd in when the program first
sets them up. USR1 gets modified each time it is ran; USR0 stays the same.

DEFUSR0 subroutine (for sound effects)
	3F00			rmb	2	
	3F02			rmb	1
	3F03			rmb	2
	3F05			rmb	2
	3F07	10 BE 3F 00	ldy	>$3f00
	3f0b	be 3f 03	ldx	>$3f03
	3f0e	a6 80		lda	,x+	Get sound value
	3f10	48		lsla		Shift to 6 bit DAC position (highest 6 bits)
	3f11	48		lsla
	3f12	b7 ff 20	sta	>$ff20	Save to DAC on PIA
	3f15	8d 0c		bsr	$3f23	Do time delay (5*PEEK($3f02) CPU cycles)
	3f17	1f 10 		tfr	x,d	Copy our sound sample ptr to D
	3f19	b3 3f 05	subd	>$3f05	Subtract end address of sample
	3f1c	26 f0		bne	$3f0e	More sample to do, continue
	3f1e	31 3f		leay	-1,y	Dec MSW of sound repeat counter
	3f20	26 e9		bne	$3f0b	More repeats, go do
	3f22	39		rts		Done, return

	3f23	b6 3f 02	lda	>$3f02	Get length of sound/note sample delay
	3f26	4a		deca		Pause that amount
	3f27	26fd		bne	$3f26
	3f28	39		rts

DEFUSR1 subroutine @ $300 (NOTE: PROGRAM POKES VALUES INTO:
NOTE: This routine is stored in BASIC's LINE INPUT buffer, which I this game doesn't use.
	0300	8E 04 00	ldx	#$400	Point to destination of copy
	0303	10 8E 00 00 	ldy	#$0000	Point to source of copy
 	0307	A6 A0		lda	,y+	Copy memory
	0309	A7 80		sta	,x+
	030B	8C 06 00	cmpx	#$600	Hit end address of destination?
	030E	25 F7		blo	$0307	no, keep copying
	030F	39		rts
